package com.xingshi.springbootinit.mq;

import com.rabbitmq.client.Channel;
import com.xingshi.springbootinit.constant.BiMqConstant;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.support.AmqpHeaders;
import org.springframework.messaging.handler.annotation.Header;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class BiDeadMessageConsumer {

    @SneakyThrows
    @RabbitListener(queues = {BiMqConstant.BI_DL_QUEUE_NAME},ackMode = "MANUAL")
    public void receiveDeadMessage(String message, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag){
        //暂时不做处理
        log.info("receive dead message:{}",message);
        channel.basicAck(deliveryTag,false);
    }
}
